# Contributor: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-plasma
maintainer="team/kde <bribbers@disroot.org>"
pkgname=drkonqi
pkgver=6.2.3
pkgrel=0
pkgdesc="The KDE crash handler"
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://kde.org/plasma-desktop/"
license="GPL-2.0-or-later"
depends="
	kirigami
	kitemmodels
	py3-sentry-sdk
	"
makedepends="
	extra-cmake-modules
	kcompletion-dev
	kconfigwidgets-dev
	kcoreaddons-dev
	kcrash-dev
	kdeclarative-dev
	ki18n-dev
	kidletime-dev
	kio-dev
	kjobwidgets-dev
	knotifications-dev
	kservice-dev
	kstatusnotifieritem-dev
	kuserfeedback-dev
	kwallet-dev
	kwidgetsaddons-dev
	py3-chai
	qt6-qtbase-dev
	samurai
	syntax-highlighting-dev
	"
checkdepends="
	py3-psutil
	py3-pygdbmi
	"

case "$pkgver" in
	*.90*) _rel=unstable;;
	*) _rel=stable;;
esac
subpackages="$pkgname-lang"
_repo_url="https://invent.kde.org/plasma/drkonqi.git"
source="https://download.kde.org/$_rel/plasma/$pkgver/drkonqi-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DWITH_PYTHON_VENDORING=OFF \
		-DCMAKE_DISABLE_FIND_PACKAGE_Systemd=ON \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_TESTING=ON
	cmake --build build
}

check() {
	# connectiontest requires a network connection
	ctest --test-dir build --output-on-failure -E "(connection|preamble)test"
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	# We don't ship systemd
	rm -r "$pkgdir"/usr/lib/systemd
}

sha512sums="
8d8175d84aa1c9e07a9c795afcde2c6800dc1396bdcd25ecb186d716304008a0246e4f4b514e04337c430c115b0ec7a1d17d8f0b5a3e02b15a62d67aba8e6ac7  drkonqi-6.2.3.tar.xz
"
